<template>
  <div class="page-header">
    <div class="page-header__main">
      <h1 class="page-header__title">{{ title }}</h1>
      <p v-if="subtitle" class="page-header__subtitle">{{ subtitle }}</p>
    </div>
    
    <div v-if="$slots.actions" class="page-header__actions">
      <slot name="actions"></slot>
    </div>
  </div>
</template>

<script setup lang="ts">
import { defineProps } from 'vue';

export interface PageHeaderProps {
  /**
   * 页面标题
   */
  title: string;
  
  /**
   * 页面副标题，可选
   */
  subtitle?: string;
}

const props = defineProps<PageHeaderProps>();
</script>

<style scoped lang="scss">
@import '@/assets/styles/variables.scss';

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: $spacing-xl;
  padding-bottom: $spacing-md;
  border-bottom: 1px solid $gray-200;
  
  &__main {
    flex: 1;
  }
  
  &__title {
    font-size: $font-size-xl;
    font-weight: $font-weight-semibold;
    color: $text-primary;
    margin: 0 0 $spacing-xs;
    line-height: $line-height-tight;
  }
  
  &__subtitle {
    font-size: $font-size-sm;
    color: $text-secondary;
    margin: 0;
    line-height: $line-height-normal;
  }
  
  &__actions {
    display: flex;
    gap: $spacing-sm;
    margin-left: $spacing-lg;
    align-items: center;
  }
  
  @media (max-width: $breakpoint-md) {
    flex-direction: column;
    align-items: flex-start;
    
    &__actions {
      margin-left: 0;
      margin-top: $spacing-md;
      width: 100%;
      justify-content: flex-start;
    }
  }
}
</style> 